package com.tan.core.enums;

import lombok.Getter;

/**
 *
 */
@Getter
public enum RedisKeyEnum {
    USER_LIST("user:list"),
    LOGIN_CAPTCHA("LOGIN_CAPTCHA"),
    USER_ROUTE("USER_ROUTE"),
    USER_ROLES("USER_ROLES"),
    ALL_MENU("ALL_MENU"),
    DICT_TYPE_CODE("DICT_DATA"),
    ;
    private final String key;

    RedisKeyEnum(String key){
        this.key = key;
    }


    /**
     * @author Tan-Bowen
     * @description 创建redis key
     * @paramType [java.lang.Object...]
     * @return java.lang.String
     */
    public String createKey(Object ...params){
        StringBuilder sb = new StringBuilder();
        sb.append(getKey());
        for(Object param:params){
            if(param!=null){
                sb.append(":");
                sb.append(param);
            }
        }
        return sb.toString();
    }
}
